<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>笑脸墙</title>
<link rel="stylesheet" type="text/css" href="control.css">
<link rel="stylesheet" type="text/css" href="control_main.css">
<script type="text/javascript">
window.onload = function(){
	searchInfo();
}
function searchInfo(){
	clearUlInner();
	var wallUser = document.getElementById("wu").value;
	var wallName = document.getElementById("wn").value;
	var publishTime = document.getElementById("control_date").value;
	var url = "/networkforum/control/wall_control.do";
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get(url+"?index=0&size=100&wallOwner="+encodeURIComponent(wallUser)+
		"&wallName="+encodeURIComponent(wallName)+"&publishTime="+publishTime,function(d){
		var data = toJson(d);
		//page.view('articleInner',article,articleOption);
		page.view("rightUlInner",data.slice(0,4),wallOption);
		window.parent.iFrameHeight();
		paging.page({
			size:4,
			total:Math.ceil(data.length/4),
			ajaxLoad:false,
			data:data,
			previou:document.getElementById("previouPage"),
			next:document.getElementById("nextPage"),
			current:document.getElementById("currentPage"),
			max:document.getElementById("totalPage"),
			callBack:function(d){
				clearUlInner();
				page.view("rightUlInner",d,wallOption);
			},
		});
	});
	myajax = null;
}
var wallOption = {
	userName:{
		param:{id:"wallUser"},
		bind:{wallId:"wallId"},
		style:{color:"blue"}
	},
	pictureSrc:{
		param:{id:"wallPicture"}
	},
	wallName:{
		param:{id:"wallName"},
	},
	publishTime:{
		param:{id:"publishTime"},
	},
	wallContents:{
		param:{id:"wallNotice"},
	},
	wallState:{
		param:{id:"wallState"},
	}
}
function wallHandle(event){
	event = event || window.event;
	var target = event.target || event.srcElement;
	var hs = document.getElementById("handleSelect");
	if(!hs){
		hs = document.getElementById("handle").cloneNode(true);
		hs.id = "handleSelect";
	}
	target.parentElement.appendChild(hs);
	var option = {
			'name':{
				'param':{'id':"name"}
			}
		};
	var param = {
			'data':[{'name':"删除"},{'name':"激活"}],
			'target':target,
		};
	page.combo("handleSelect",param,option);
}
function save(){
	var items = document.getElementsByClassName("checkBox");
	
	var len = items.length;
	var wallIds = new Array();
	var states = new Array();
	for(var i =0;i<len ;i++){
		var ite = items[i];
		if(ite.checked){
			var li = ite.parentElement;
			var wallId = li.children[1].wallId;
			var state = li.children[li.children.length-2].value;
			//arr.push({userId:userId,roleName:roleName});
			wallIds.push(wallId);
			states.push(state);
		}
	}
	if(wallIds.length==0){
		return;
	}
	var url = "/networkforum/control/wall_control_change.do";
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get(url+"?wallIds="+wallIds+"&states="+states,function(d){
		searchInfo();
	});
	myajax = null;
}
</script>
</head>

<body>
	<div id="rightNav">
        <ul class="rightUl">
        	<li>
                <span>发布人</span>
                <input id="wu" type="text"/>
            </li>
            <li>
                <span>名称</span>
                <input id="wn" type="text"/>
            </li>
            <li>
                <span>发布时间</span>
                 <input name="control_date" id="control_date" type="text" value="" readonly="true" onclick="new Calendar().show(this);" />
            </li>
        </ul>
        <span id="search" onClick="searchInfo();">搜索</span>
    </div>
    <div id="userCenter" class="rightCenter">
        <ul id="rightUlInner" class="rightUlInner">
          <li style="display:none;">
                <input type="checkbox" class="checkBox" style="width:5%;margin-right:4px;"/>
                <span id="wallUser" style="width:10%;"></span>
                <div style="display: inline-block;text-align: left;width: 15%;">
	             	<img id="wallPicture" style="width:100px;height: 80px;"></img>
                </div>
             	<span id="wallName" style="width:10%"></span>
             	<span id="publishTime" style="width:15%;"></span>
             	<span id="wallNotice" style="width:20%;"></span>
             	<span id="wallState" style="width:5%;text-align:center;"></span>
                <input type="text" onclick="wallHandle(event);" readonly style="width:55px;margin-left:20px;"/>
         </li>
         <li id="header">
             <span style="width:5%;">选择</span>
             <span style="width:10%;">发布人</span>
             <span style="width:15%;">图片</span>
             <span style="width:10%;">名称</span>
             <span style="width:15%;">发布时间</span>
             <span style="width:20%;">备注</span>
             <span style="width:5%;text-align:center;">状态</span>
             <span style="width:10%;text-align:center;">管理</span>
         </li>
        </ul>
         <ul id="handle" style="display:none;">
            <li>
            	<span id="name"></span>
            </li>
        </ul>
    <div class="paging" id="paging">
	   		<div class="clear"></div>
	   		<span id="previouPage" style="cursor: pointer;">上一页</span>
	   		<!--  <span id="currentPage2">1</span>-->
	   		<input id="currentPage" type="text" value = "1"/>	
	   		<span id="nextPage" style="cursor: pointer;">下一页</span>
	   		<span id="totalPage">共 1 页</span>
	   	</div>
    </div>
    <span id="saveButtom" onclick="save();">保存</span>
</body>
<script type="text/javascript" src="control_main.js"></script>
<script src="../js/view.js" type="text/javascript"></script>
<script src="../js/combo.js" type="text/javascript"></script>
<script src="../js/myajax.js" type="text/javascript"></script>
<script src="../js/pageing.js" type="text/javascript"></script>

<script type="text/javascript" src="/networkforum/js/Calendar3.js"></script>
</html>
